//
//  MJ_ReprotHeadCell.m
//  UEAssistant
//
//  Created by mac on 2018/1/5.
//  Copyright © 2018年 youyixinxi. All rights reserved.
//

#import "MJ_ReprotHeadCell.h"
#import "UIColor+Extend.h"
@interface MJ_ReprotHeadCell ()

@property (weak, nonatomic) IBOutlet UIButton *startTimeBtn;

@property (weak, nonatomic) IBOutlet UIButton *endTimeBtn;

@property (weak, nonatomic) IBOutlet UIButton *today;

@property (weak, nonatomic) IBOutlet UIButton *yesterday;

@property (weak, nonatomic) IBOutlet UIButton *theDayBeforeYesterday;

@property (weak, nonatomic) IBOutlet UIButton *week;

@property (weak, nonatomic) IBOutlet UIButton *month;

@end

@implementation MJ_ReprotHeadCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.today.layer.borderWidth = 1;
    self.today.layer.borderColor = [UIColor colorWithHexString:@"#bdbdbd"].CGColor;
    
    self.yesterday.layer.borderWidth = 1;
    self.yesterday.layer.borderColor = [UIColor colorWithHexString:@"#bdbdbd"].CGColor;
    
    self.theDayBeforeYesterday.layer.borderWidth = 1;
    self.theDayBeforeYesterday.layer.borderColor = [UIColor colorWithHexString:@"#bdbdbd"].CGColor;
    
    self.week.layer.borderWidth = 1;
    self.week.layer.borderColor = [UIColor colorWithHexString:@"#bdbdbd"].CGColor;
    
    self.month.layer.borderWidth = 1;
    self.month.layer.borderColor = [UIColor colorWithHexString:@"#bdbdbd"].CGColor;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    // Configure the view for the selected state
}
- (IBAction)start:(id)sender {
    
    [_delegate clickWithType:MJTimeSelectTypeStart button:sender cell:self];
}

- (IBAction)end:(id)sender {
    [_delegate clickWithType:MJTimeSelectTypeEnd button:sender cell:self];

}

- (IBAction)conditionPressed:(UIButton *)sender {
    MJTimeSelectType type;
    if ([sender isEqual:self.today]) {
        type = MJTimeSelectTypeToday;
        
    }else if ([sender isEqual:self.yesterday]) {
        type = MJTimeSelectTypeYesterday;
        
    }else if ([sender isEqual:self.theDayBeforeYesterday]) {
        type = MJTimeSelectTypeTheDayBeforeYesterday;
        
    }else if ([sender isEqual:self.week]) {
        type = MJTimeSelectTypeWeek;
        
    }else {
        type = MJTimeSelectTypeMonth;
    }
    [_delegate clickWithType:type button:sender cell:self];
}
 

@end
